package com.hengdu.cms.common;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class RouteCustomer {

	@RabbitListener(bindings = { @QueueBinding(value = @Queue, // 创建临时队列
			exchange = @Exchange(value = "directs", type = "direct"), // 自定义交换机名称和类型
			key = { "info", "error" } //
			) })
	public void receive1(String messge) {

		System.out.println("消费者1:" + messge);
	}

	@RabbitListener(bindings = { @QueueBinding(value = @Queue, // 创建临时队列
			exchange = @Exchange(value = "directs", type = "direct"), // 自定义交换机名称和类型
			key = { "info" } //
			) })
	public void receive2(String messge) {

		System.out.println("消费者2:" + messge);
	}
}
